package our.pack;

import java.io.Serializable;

import com.google.android.maps.GeoPoint;

import android.location.Location;
import android.util.Log;

public class MyPoint implements Serializable{
	private final static String TAG = "MyPoint";	
	private long pointsID;
	private int latitude;
	private int longitude;
	private long TrackID;
	private double time;
	private Location location;
	private int speed;
	private GeoPoint geoPoint;
	
	
	


	


	public MyPoint () {
		// geoPoint into the Constructor, DB?
	}
	
	
	public int getDistance(MyPoint myP2){ // insert previous location here
		assert myP2 != null : "Second point is null";
		
		int distance = (int) this.getLocation().distanceTo(myP2.getLocation()); // returns distance in meters
		distance = distance/1000; // returns distance in Kilometers
		
		return distance;
	}
	
	public GeoPoint getGeoPoint() {
		return geoPoint;
	}


	public void setGeoPoint(GeoPoint geoPoint) {
		this.geoPoint = geoPoint;
	}

	
	
	


	public int getTimeBetween(MyPoint myP2){ // insert previous location here
		int time = (int) ((myP2.getLocation().getTime()) - (this.getLocation().getTime())); // returns difference in milliseconds
		time = time * 1000; // time in seconds
		time = time * 3600; // time in hours
		return time;
	}
	
	/* GETTERS AND SETTERS */
	
	public double getTime() {
		return  location.getTime();
	}

	public void setTime(double time) {
		this.time = time;
	}
	
	public Location getLocation() {
		return location;
	}
	public void setLocation(Location location) {
		this.location = location;
	}
	
	public long getPointsID() {
		return pointsID;
	}
	public void setPointsID(long pointsID) {
		this.pointsID = pointsID;
	}
	public int getLatitude() {
		return latitude;
	}
	public void setLatitude(int latitude) {
		this.latitude = latitude;
	}
	public int getLongitude() {
		return longitude;
	}
	public void setLongitude(int longitude) {
		this.longitude = longitude;
	}
	public long getTrackID() {
		return TrackID;
	}
	public void setTrackID(long trackID) {
		TrackID = trackID;
	}
	
	public int getSpeed() {
		return speed;
	}

	public void setSpeed(int speed) {
		this.speed = speed;
	}


	

}
